package com.zhangj.alljvm.oom;

import java.nio.ByteBuffer;

/**
 * @ClassName OutOfMemoryErrorTest03
 * @Description
 * @Author zhangjie
 * @Date 2022/3/12 8:30
 * @Version 1.0
 */
public class OutOfMemoryErrorTest03 {
    public static void main(String[] args) {

        //调整参数方便报错
        //-Xmx10m -Xms10m -XX:+PrintGCDetails -XX:MaxDirectMemory=5m



        ByteBuffer.allocateDirect(6*1024*1024);
        //Exception in thread "main" java.lang.OutOfMemoryError: Direct buffer memory

    }
}
